package heven.holt.wan.android.binding

import android.widget.TextView
import androidx.databinding.BindingAdapter

@BindingAdapter("android:coin_record_title")
fun coinRecordTitle(textView: TextView, desc: String) {
    val firstSpace = desc.indexOf(" ")
    val secondSpace = desc.indexOf(" ", firstSpace + 1)
    textView.text = desc.substring(secondSpace + 1)
        .replace(",", "")
        .replace("：", "")
        .replace(" ", "")
}

@BindingAdapter("android:coin_record_time")
fun coinRecordTime(textView: TextView, desc: String) {
    val firstSpace = desc.indexOf(" ")
    val secondSpace = desc.indexOf(" ", firstSpace + 1)
    textView.text = desc.substring(0, secondSpace)
}